Skip to content

[Example] 500 — Semantic Kernel Voice Plugin (.NET/C#)#191

Open
github-actions[bot] wants to merge 1 commit intomainfrom
example/500-semantic-kernel-voice-plugin-dotnet
Open

[Example] 500 — Semantic Kernel Voice Plugin (.NET/C#)#191
github-actions[bot] wants to merge 1 commit intomainfrom
example/500-semantic-kernel-voice-plugin-dotnet

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 6, 2026

New example: Semantic Kernel Voice Plugin (.NET/C#)

Integration: Microsoft Semantic Kernel | Language: C# | Products: STT, TTS

What this shows

A Deepgram plugin for Microsoft Semantic Kernel that exposes STT (pre-recorded transcription) and TTS (Aura-2) as [KernelFunction] attributes. Includes a console app with an agent chat loop where the AI agent can autonomously choose to transcribe audio files/URLs or synthesize speech.

Required secrets

  • DEEPGRAM_API_KEY
  • OPENAI_API_KEY (for the Semantic Kernel LLM backend)

Tests

✅ Tests passed

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 4.8007 Seconds

Built by Engineer on 2026-04-06

@github-actions github-actions bot added type:example New example language:csharp Language: C# integration:semantic-kernel Integration: Semantic Kernel labels Apr 6, 2026
@github-actions github-actions bot force-pushed the example/500-semantic-kernel-voice-plugin-dotnet branch from ba3b5fc to 6a55828 Compare April 6, 2026 05:24
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot force-pushed the example/500-semantic-kernel-voice-plugin-dotnet branch from 6a55828 to 92f9c75 Compare April 6, 2026 05:27
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 6, 2026

Code Review

Overall: APPROVED

Tests ran ✅

Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakTextStream_ReturnsBase64Audio [1 s]
Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.TranscribeUrl_ReturnsNonEmptyTranscript [606 ms]
Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakText_CreatesAudioFile

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 4.4656 Seconds

Integration genuineness

✅ Pass

  • Microsoft Semantic Kernel SDK imported and used (Microsoft.SemanticKernel v1.74.0)
  • [KernelFunction] attributes expose Deepgram STT/TTS as Semantic Kernel plugin functions
  • FunctionChoiceBehavior.Auto() enables real agent-driven function calling
  • .env.example lists both DEEPGRAM_API_KEY and OPENAI_API_KEY
  • Tests exit with code 2 when credentials are missing — no fake passes
  • No bypass: Deepgram calls flow through the SK plugin pattern (SK has no native audio interface)
  • No raw WebSocket/fetch — all Deepgram contact via official .NET SDK

Code quality

  • ✅ Official Deepgram .NET SDK v6.6.1 (matches required version)
  • tag: "deepgram-examples" on all STT calls (TTS SpeakSchema has no Tag property in SDK 6.6.1 — SDK limitation, not an omission)
  • ✅ No hardcoded credentials
  • ✅ Credential check runs before SDK initialization in both Program.cs and tests
  • ✅ Error handling covers missing credentials with Environment.Exit(2)
  • ✅ Tests import from src/ via ProjectReference and call the plugin's actual methods
  • ✅ Transcript assertions use proportional length check (transcript.Length >= 10), no flaky word lists
  • ✅ Audio assertions use proportional byte-size checks (> 1000 bytes)

Documentation

  • ✅ README has "What you'll build", prerequisites, env var table with links, install/run instructions, key parameters, and how-it-works section
  • .env.example present and complete with both vars and source links

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-06

@github-actions github-actions bot added the status:review-passed Self-review passed label Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 6, 2026

Code Review

Overall: APPROVED

Tests ran ✅

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 4.6382 Seconds

  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.TranscribeUrl_ReturnsNonEmptyTranscript [977 ms]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakText_CreatesAudioFile [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakTextStream_ReturnsBase64Audio [1 s]

Real Deepgram API calls confirmed — STT transcription returned a transcript, TTS produced audio files > 1 KB.

Integration genuineness

Pass — all 6 checks pass:

  1. Microsoft Semantic Kernel SDK imported and used ([KernelFunction] attributes, Kernel.CreateBuilder(), FunctionChoiceBehavior.Auto())
  2. Real API calls to both Deepgram (STT/TTS) and OpenAI (chat completion via Semantic Kernel)
  3. .env.example lists DEEPGRAM_API_KEY and OPENAI_API_KEY with console links
  4. Tests exit with code 2 if DEEPGRAM_API_KEY is missing; all tests make real API calls
  5. Bypass check N/A — Semantic Kernel is an orchestration framework, not an audio interface; DeepgramPlugin is correctly registered as a Kernel plugin
  6. No raw WebSocket/fetch calls — all Deepgram contact through official SDK

Code quality

  • ✅ Official Deepgram .NET SDK v6.6.1 (matches required version)
  • tag: ["deepgram-examples"] on all STT calls (TranscribeUrl, TranscribeFile). TTS SpeakSchema does not expose a Tag property in SDK v6.6.1 — not fixable on the example side.
  • ✅ No hardcoded credentials — all from environment variables
  • ✅ Credential check runs before SDK initialization in both Program.cs and tests
  • ✅ Error handling: exit code 2 on missing credentials
  • ✅ Tests import DeepgramPlugin from src/ and call its actual methods
  • ✅ Assertions use proportional checks (character length, byte size) — no specific word lists
  • packages.lock.json present with RestorePackagesWithLockFile enabled

Documentation

  • ✅ README: explains what you'll build, lists prerequisites, env vars with links, install/run instructions, key parameters, and how-it-works section
  • .env.example present and complete with comment links to credential sources

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-06

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 6, 2026

Code Review

Overall: APPROVED

Tests ran ✅

  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakText_CreatesAudioFile [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakTextStream_ReturnsBase64Audio [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.TranscribeUrl_ReturnsNonEmptyTranscript [518 ms]

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 3.9852 Seconds

Real Deepgram API calls confirmed — STT transcription returned text, TTS returned audio files and base64 audio data.

Integration genuineness

Pass — All 6 checks pass.

  1. Platform SDK imported: Microsoft.SemanticKernel used throughout; [KernelFunction] attributes expose Deepgram as SK plugin functions.
  2. Real API calls: Tests make live Deepgram STT and TTS calls via the plugin. Program.cs uses SK's FunctionChoiceBehavior.Auto() for agent-driven invocation.
  3. .env.example: Lists both DEEPGRAM_API_KEY and OPENAI_API_KEY with where-to-get links.
  4. Credential guard: Tests exit with code 2 if DEEPGRAM_API_KEY is missing; Program.cs exits 2 if either key is missing.
  5. Bypass check: Semantic Kernel has no native Deepgram interface — the [KernelFunction] plugin pattern is the correct integration mechanism. No direct DeepgramClient bypass.
  6. No raw protocol: All Deepgram API contact goes through the official Deepgram NuGet SDK. No WebSocket, ws(), or fetch() calls.

Code quality

  • ✅ Official Deepgram .NET SDK v6.6.1 (matches required version)
  • tag: "deepgram-examples" present on all STT calls (TranscribeUrlAsync, TranscribeFileAsync)
  • ℹ️ TTS calls (SpeakTextAsync, SpeakTextStreamAsync) do not include tag — confirmed SpeakSchema in SDK v6.6.1 has no Tag property; this is an SDK limitation, not a code issue
  • ✅ No hardcoded credentials
  • ✅ Error handling: credential checks run first (before Library.Initialize()), exit code 2 on missing creds
  • ✅ Tests import from src/ and call the plugin's actual methods
  • ✅ Assertions use proportional length checks (character count, byte count) — no word-list assertions
  • packages.lock.json included for deterministic restores

Documentation

  • ✅ README has "What you'll build", prerequisites, env var table with links, install/run instructions, key parameters, and how-it-works explanation
  • .env.example present and complete with both required keys and source links

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-06

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 6, 2026

Code Review

Overall: APPROVED

Tests ran ✅

  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakText_CreatesAudioFile [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakTextStream_ReturnsBase64Audio [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.TranscribeUrl_ReturnsNonEmptyTranscript [1 s]

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 4.9563 Seconds

Real Deepgram API calls confirmed — STT transcription via TranscribeUrl and TTS via ToFile/ToStream all returned valid responses.

Integration genuineness

Pass — all 6 checks satisfied:

  1. Semantic Kernel SDK imported and used (Kernel.CreateBuilder(), [KernelFunction], ImportPluginFromType, FunctionChoiceBehavior.Auto())
  2. Real API call to Semantic Kernel's chat completion (GetChatMessageContentAsync) with auto function calling
  3. .env.example lists both DEEPGRAM_API_KEY and OPENAI_API_KEY with where-to-get links
  4. Tests exit(2) when credentials are missing — no fake passes
  5. Bypass check: Semantic Kernel is an orchestration framework, not an audio wrapper — using DeepgramClient (via ClientFactory) directly is the correct pattern since SK has no built-in Deepgram interface
  6. No raw WebSocket/fetch calls — all Deepgram API contact goes through the official .NET SDK

Code quality

  • ✅ Official Deepgram .NET SDK v6.6.1 (matches required version)
  • tag: "deepgram-examples" present on all STT calls (TranscribeUrl, TranscribeFile). TTS calls (SpeakSchema) don't include tag because SpeakSchema in SDK v6.6.1 does not expose a Tag property — this is an SDK limitation, not a code oversight.
  • ✅ No hardcoded credentials
  • ✅ Error handling: credential check with Environment.Exit(2) in both Program.cs and test constructor
  • ✅ Tests import from src/ and call the plugin's actual exported methods (TranscribeUrlAsync, SpeakTextAsync, SpeakTextStreamAsync)
  • ✅ Assertions use proportional checks (transcript length ≥ 10 chars, audio file > 1000 bytes, base64 audio > 1000 bytes) — no word-list assertions
  • ✅ Credential check runs before Library.Initialize() and SDK usage
  • packages.lock.json committed for reproducible builds

Documentation

  • ✅ README: "What you'll build" section, prerequisites, env var table with where-to-get links, install/run instructions, key parameters, how-it-works explanation
  • .env.example present and complete with both required variables
  • .gitignore excludes bin/ and obj/

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-06

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 7, 2026

Code Review

Overall: APPROVED

Tests ran ✅

  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakText_CreatesAudioFile [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.SpeakTextStream_ReturnsBase64Audio [1 s]
  Passed DeepgramSemanticKernel.Tests.DeepgramPluginTests.TranscribeUrl_ReturnsNonEmptyTranscript [1 s]

Test Run Successful.
Total tests: 3
     Passed: 3
 Total time: 4.9555 Seconds

Integration genuineness

Pass. Microsoft Semantic Kernel SDK is imported and used to build a real agent with FunctionChoiceBehavior.Auto(). The DeepgramPlugin class registers four [KernelFunction] methods that the SK agent can autonomously invoke. Semantic Kernel is an orchestration framework without its own Deepgram interface, so using the Deepgram SDK directly via ClientFactory is the correct pattern. No bypass — audio operations flow through the SK plugin architecture.

Code quality

  • ✅ Official Deepgram SDK v6.6.1 (matches required .NET version)
  • tag: "deepgram-examples" on all STT calls (TranscribeUrlAsync, TranscribeFileAsync). TTS SpeakSchema does not support a Tag property in SDK v6.6.1, so omission is expected.
  • ✅ No hardcoded credentials
  • ✅ Credential check runs FIRST — before Library.Initialize() in Program.cs, and before SDK init in test constructor
  • ✅ Tests import from src/ and call the plugin's actual methods
  • ✅ Transcript assertions use proportional length checks (not word lists)
  • ✅ Error handling covers missing env vars with exit code 2

Documentation

  • ✅ README covers what you'll build, all env vars with where-to-get links, install/run instructions
  • .env.example present and complete with both DEEPGRAM_API_KEY and OPENAI_API_KEY

✓ All checks pass. Ready for merge.


Review by Lead on 2026-04-07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:semantic-kernel Integration: Semantic Kernel language:csharp Language: C# status:review-passed Self-review passed type:example New example

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants